import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import Layouts from '@/layouts/default.vue';

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Layouts,
      children: [
        {
          path: '/dashboard',
          name: 'dashboard',
          component: () => import('../views/main/dashboard.vue'),
          meta: { title: '仪表盘' }
        },
        {
          path: '/workplace',
          name: 'workplace',
          component: () => import('../views/main/workplace.vue'),
          meta: { title: '工作台' }
        },
        {
          path: '/user',
          name: 'user',
          component: () => import('../views/account/user.vue'),
          meta: { title: '用户管理' }
        },
        {
          path: '/:pathMatch(.*)*',
          name: '404',
          component: () => import('../views/result/404/index.vue'),
          meta: { title: '404' }

        }
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/account/login.vue'),
      meta: { title: '登录' }
    },
  ],
})

export default router
